/*
  non-Newtonian fluid with pressure- and shear-dependent viscosity
  
  Viscosity is of the form
   
     mu_0(A+|Du|^2)^((r-2)/2).
   
*/
#include "fem/stateproblem.h"
#include "papcel/tof.h"


class C3DNonNewtonianStokesProblem : public C3DFlowProblem
{
 private:
  int    conv;
  double PAR_A, PAR_alpha, PAR_mu0, PAR_r, PAR_q, PAR_sigma1, PAR_sigma2, delta;
  CVar   diverg, visco;
  map<int, bool> outflows; // boundaries where outflow b.c. is applied
  map<int, double> outflow_p; // outflow/inflow pressures
 
 public:
  C3DNonNewtonianStokesProblem();
  ~C3DNonNewtonianStokesProblem();
  CVec &getQ() { return q; };
  
  virtual void afterReadConfig(const Json::Value &input_obj);
  void afterPrepare();
  void afterEvaluateVolumeComponents(int elem, int qp);
  
  bool useVolumeIntegral() { return true; };
  bool useFaceIntegral() { return true; };
  bool useEdgeIntegral() { return false; };
  CVar volumeIntegral(int comp, int elem, int qp);
  CVar edgeIntegral(int comp, int elem);
  
  void saveOutflow();
  void savePressure();
};


